﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace lcs.Web.WorkFlow
{
    public partial class ListDemandPlan : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["login"]  != null)
                {
                    DataSet ds = Session["login"] as DataSet;

                    string user_id = ds.Tables[0].Rows[0]["user_id"].ToString();

                    BindDaiban("0", user_id);
                }
               // BindDaiBan();
            }
        }

        private void BindDaiban(string workFlow_status, string person_id)
        {

            DataSet check = new Maticsoft.BLL.workFlow().GetDaiBanCheck(workFlow_status, person_id,1,"审核");

            this.GridView1.DataSource = check;
            this.GridView1.DataBind();
        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "check")
            {
                string dpid = e.CommandArgument.ToString();

                if (Session["login"] != null)
                {
                    DataSet ds = Session["login"] as DataSet;

                    string user_id = ds.Tables[0].Rows[0]["user_id"].ToString();
                    string roles_id = ds.Tables[0].Rows[0]["roles_id"].ToString();

                    //if (roles_id == "21")//需求计划审核专工
                    //{
                    //    Response.Redirect("DemandPlanCheck.aspx?id=" + dpid);
                    //}
                    //else 
                        
                    if (roles_id == "22")//需求计划审核专工-财务
                    {
                        Response.Redirect("DemandPlanCheckInvoiceType.aspx?id=" + dpid);
                    }
                    else //需求计划审核专工
                    {
                        Response.Redirect("DemandPlanCheck.aspx?id=" + dpid);
                    }
                    

                }

               
            }
        }
    }
}